#include "rgb_led.h"


Pixel::Pixel()
{
	FastLED.addLeds<WS2812, RGB_LED_PIN, GRB>(color_buffers, RGB_LED_NUM);
	FastLED.setBrightness(200);
}

void Pixel::setRGB(int r, int g, int b)
{
	color_buffers[0] = CRGB(r, g, b);
	color_buffers[1] = CRGB(r, g, b);
	FastLED.show();
}

void Pixel::setHSV(int h, int s, int v)
{
	color_buffers[0].setHSV(h, s, v);
	color_buffers[1].setHSV(h, s, v);
	FastLED.show();
}

void Pixel::setBrightness(float duty)
{
	duty = constrain(duty, 0, 1);
	FastLED.setBrightness((uint8_t)(255 * duty));
	FastLED.show();
}
